/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 邓大帅
 * Date: 2022-11-16
 * Time: 17:43
 */
public class SumNum {
    public static int sumNum(int n) {
        if (n <= 9) {
            return n;
        }
        return (n % 10) + sumNum(n / 10);
    }
    public static void main(String[] args) {
        int n = 1234;
        System.out.println(sumNum(n));
    }
}
